package com.nova.bluetooth.ui.ai;

import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.nova.bluetooth.R;
import com.nova.bluetooth.base.BaseFragment;
import com.nova.bluetooth.databinding.FragmentAiTabBinding;
import com.nova.bluetooth.ui.ai.aiNote.AudioFileToTextActivity;
import com.nova.bluetooth.ui.ai.aiNote.VoiceToTextActivity;
import com.nova.bluetooth.ui.ai.translate.AudioTranslatingActivity;
import com.nova.bluetooth.ui.ai.translate.FaceTranslateActivity;

/**
 *
 */
public class AITabFragment extends BaseFragment {
    private FragmentAiTabBinding binding;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_ai_tab, container, false);
        binding = FragmentAiTabBinding.bind(view);
        initView();
        return binding.getRoot();
    }

    private void initView() {
        binding.layoutAudioTranslate.setOnClickListener(onClickEvent);
        binding.layoutFaceTranslate.setOnClickListener(onClickEvent);
        binding.layoutAudioToText.setOnClickListener(onClickEvent);
        binding.layoutAudioFileToText.setOnClickListener(onClickEvent);
        binding.layoutTts.setOnClickListener(onClickEvent);
    }

    private final View.OnClickListener onClickEvent = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (v.getId() == R.id.layout_audio_translate) {
                startActivity(new Intent(getActivity(), AudioTranslatingActivity.class));
            } else if (v.getId() == R.id.layout_face_translate) {
                startActivity(new Intent(getActivity(), FaceTranslateActivity.class));
            } else if (v.getId() == R.id.layout_audio_to_text) {
                startActivity(new Intent(getActivity(), VoiceToTextActivity.class));
            } else if (v.getId() == R.id.layout_audio_file_to_text) {
                startActivity(new Intent(getActivity(), AudioFileToTextActivity.class));
            } else if (v.getId() == R.id.layout_tts) {
                AIContainerActivity.startThisActivity(getActivity(), AIContainerActivity.FRAGMENT_TAG_TTS);
            }
        }
    };

    @Override
    public void onDestroyView() {
        super.onDestroyView();
    }
}
